package com.linjuke.childay.common;

import com.linjuke.childay.androidext.ChildayApplication;

public class GlobalUtil {
	
	private static ChildayApplication childayApplication;

	private static float density = 1.0f;
	
	public static ChildayApplication getChildayApplication() {
		return childayApplication;
	}
	
	public static void init(ChildayApplication childayApplication) {
		GlobalUtil.childayApplication = childayApplication;
		density = childayApplication.getResources().getDisplayMetrics().density;
	}
	
	public static int pixelToDip(int pixel) {
		return (int)(pixel / density);
	}
	
	public static int dipToPixel(int dip) {
		return (int)(dip * density);
	}

}
